#!/bin/bash

echo "=== 构建 UEStudio 生态系统 ==="

cd /d/vc/UEStudio/Ecosystem

# 检查依赖
echo "检查依赖..."
if [ ! -d "/d/vc/wxWidgets" ]; then
    echo "❌ 错误: wxWidgets 未找到在 /d/vc/wxWidgets"
    exit 1
fi

if [ ! -d "/d/vc/UEStudio/Tools/UniversalNodeManager" ]; then
    echo "❌ 错误: UniversalNodeManager 未找到"
    exit 1
fi

# 创建构建目录
mkdir -p build
cd build

echo "配置CMake..."
cmake .. -DCMAKE_BUILD_TYPE=Release

echo "编译..."
make -j$(nproc)

if [ $? -eq 0 ]; then
    echo ""
    echo "✅ 构建成功!"
    echo "📁 输出文件:"
    echo "   - build/libuestudio_ecosystem.a (静态库)"
    echo "   - build/ecosystem_demo (演示程序)"
    echo ""
    echo "🚀 运行演示: ./build/ecosystem_demo"
else
    echo "❌ 构建失败"
    exit 1
fi
